package com.xxx.demo.data.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xxx.demo.data.entity.Wsunit;
import com.xxx.demo.data.mapper.WsunitMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 设备信息表
 * @Author: server-boot
 * @Date:   2020-07-21
 * @Version: V1.0
 */
@Service
public class WsunitService extends ServiceImpl<WsunitMapper, Wsunit> implements IService<Wsunit> {

    /**
     * 按设备号查询设备信息
     * @param untid
     * @return
     */
    public Wsunit getByUntid(String untid) {
        LambdaQueryWrapper<Wsunit> query = new LambdaQueryWrapper<>(new Wsunit().setUntid(untid));

        List<Wsunit> list = this.list(query);
        if(list != null && list.size() > 0){
            return list.get(0);
        }else{
            return null;
        }
    }
}
